package com.prototype.protoType;

import java.util.HashMap;

/**
 * @author Vhong
 * @version 1.0
 * 原型管理器
 */
public class ProtoTypeManager {
    private HashMap<String, Shape> ht = new HashMap<>();

    public ProtoTypeManager() {
        ht.put("圆形", new Circle());
        ht.put("正方形", new Square());
    }

    public void addshape(String key, Shape obj) {
        ht.put(key, obj);
    }

    public Shape getShape(String key) {
        Shape temp = ht.get(key);
        return (Shape)temp.clone();
    }
}
